<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title><%= yield :title || (t "general.page_title") %></title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="<%= t 'general.description' %>">
  <meta name="author" content="<%= t 'general.author' %>">
  <meta name="keyword" content="<%= t 'general.keywords' %>">
  <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300&subset=latin,vietnamese' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="<%= asset_path('bootstrap.min.css') %>">
  <link rel="stylesheet" href="<%= asset_path('bootstrap-responsive.min.css') %>">
  <link rel="stylesheet" href="<%= asset_path('jquery.pnotify.default.css') %>">
  <link rel="stylesheet" href="<%= asset_path('main.css') %>">
  <%= yield :queue_css %>
  <script type="text/javascript" src="<%= asset_path('jquery-1.8.1.min.js') %>"></script>
  <script type="text/javascript" src="<%= asset_path('bootstrap.js') %>"></script>
  <script type="text/javascript" src="<%= asset_path('jquery.pnotify.min.js') %>"></script>
  <%= yield :queue_js %>
  <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
  <!--[if lt IE 9]>
  <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
</head>

<body>

<div class="navbar navbar-inverse navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container" style="width:70%">
      <%= link_to (t "general.sitename"), {:controller => "frontend/portal"}, :class => "brand" %>
      <div class="nav-collapse collapse">
        <ul class="nav">
          <li
          <% if current_page?(:controller => 'frontend/portal', :action => 'index') %>class="active"
          <% end %>><%= link_to (t "general.navigation.home"), :controller => "frontend/portal" %></li>
          <li
          <% if current_page?(:controller => 'frontend/library', :action => 'index') %>class="active"
          <% end %>><%= link_to (t "general.navigation.library"), :controller => "frontend/library", :action => "index" %></a></li>
          <li
          <% if current_page?(:controller => 'frontend/portal', :action => 'info') %>class="active"
          <% end %>><%= link_to (t "general.navigation.info"), :controller => "frontend/portal", :action => "info" %></a></li>
          <% if is_admin %>
              <li
              <% if current_page?(:controller => 'backend/dashboard', :action => 'index') %>class="active dropdown"
              <% else %> class="dropdown"
              <% end %>>
                <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%= t "general.navigation.admin" %>
                  <b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <li><a href="<%= url_for(:controller => "backend/dashboard") %>">Trang quản lý</a></li>
                  <li class="divider"></li>
                  <li class="nav-header">Quản lý thư viện</li>
                  <li><a href="<%= url_for(:controller => "backend/library", :action => "index") %>">Danh mục tài liệu</a></li>
                  <li><a href="<%= url_for(:controller => "backend/library", :action => "new") %>">Thêm tài liệu mới</a></li>
                  <li><a href="<%= url_for(:controller => "backend/library", :action => "lend_document") %>">Ký mượn tài liệu</a></li>
                  <li><a href="<%= url_for(:controller => "backend/library", :action => "return_document") %>">Trả tài liệu</a></li>
                  <li class="divider"></li>
                  <li class="nav-header">Người dùng</li>
                  <li><a href="<%= url_for(:controller => "backend/user", :action => "index") %>">Danh sách người dùng</a></li>
                  <!--<li><a href="#">Tạo người dùng mới</a></li>-->
                </ul>
              </li>
          <% end %>
        </ul>
        <% unless session[:student].nil? %>
            <ul class="nav pull-right">
              <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">Chào bạn, <%= session[:student][:login] %>
                  <b class="caret"></b></a>
                <ul class="dropdown-menu">
                  <li><%= link_to("Cập nhật thông tin cá nhân", :controller => "frontend/portal", :action => "updateprofile") %></li>
                  <li><%= link_to("Gửi hoạt động mới", :controller => "frontend/activity", :action => "new") %></li>
                  <% unless is_admin %>
                      <li><%= link_to("Tài liệu đã mượn", :controller => "frontend/library", :action => "borrowlist", :user_id => session[:student][:id]) %></li>
                  <% end %>
                  <li><%= link_to("Đăng xuất", :controller => "frontend/portal", :action => "logout") %></li>
                </ul>
              </li>
            </ul>
            <%= yield :top_menu_logged_in %>
        <% end %>
        <%= yield :top_menu %>
      </div>
      <!--/.nav-collapse -->
    </div>
  </div>
</div>
<div class="container" style="width:70%"><!---->
  <% # popup alert   %>
  <% unless flash.now.blank? %>
      <% flash.each do |name, msg| %>
          <% if msg.is_a?(Array) %>
              <% msg.each do |m| %>
                  <div class="alert alert-<%= name.to_s=="notice" ? "success" : "error" %>">
                    <button type="button" class="close" data-dismiss="alert">×</button>
                    <%= m %>
                  </div>
                  <script type="text/javascript">
                      $(function () {
//                          $.pnotify({
//                              title:'<%= t"general.#{name}" %>',
//                              text:'<%= m %>',
//                              type:'<%= name.to_s=="notice"? "success": "error" %>',
//                              icon:'icon-eye-open',
//                              shadow:false,
//                              delay:'1000'
//                          });
                      });
                  </script>
              <% end %>
          <% else %>
              <div class="alert alert-<%= name.to_s=="notice" ? "success" : "error" %>">
                <button type="button" class="close" data-dismiss="alert">×</button>
                <%= msg %>
              </div>
              <script type="text/javascript">
                  $(function () {
//                      $.pnotify({
//                          title:'<%= t"general.#{name}" %>',
//                          text:'<%= msg %>',
//                          type:'<%= name.to_s=="notice"? "success": "error" %>',
//                          icon:'icon-eye-open',
//                          shadow:false,
//                          delay:'1000'
//                      });
                  });
              </script>
          <% end %>
      <% end %>
  <% end %>
  <%= yield :top_section %>
  <!--main page-->
  <div class="row-fluid">
    <div class="span9" style="min-height:450px;">
      <%= yield %>
    </div>
    <div class="span3"><%= yield :sidebar %></div>
  </div>
  <div class="row-fluid">
    <div class="span12" style="margin-top:50px;">
      <footer class="pull-right">
        <p>
          &copy;2012 Student Portal.
        </p>
      </footer>
    </div>
  </div>
</div>
<!-- /container -->
</body>
</html>
